import TSpace.Tuple;
import TSpace.TupleSpace;

public class Client
{
	private TSClient myClient;

	public Client(String serverMachineName, String serverMachinePort, int spaceNumber)
	{
		String args[] = new String[4];

		args[0] = "-ORBInitialHost";
		args[1] = serverMachineName;
		args[2] = "-ORBInitialPort";
		args[3] = serverMachinePort;
//		args[4] = "-Djava.naming.provider.url=iiop://" + serverMachineName + ":" + serverMachinePort;
//		args[5] = "-Dorg.omg.CORBA.ORBInitialHost=" + serverMachinePort;

		myClient = new TSClient(args, spaceNumber);
	}

	public boolean write(Object e1, TupleType typeE1) {
		return myClient.write(e1, typeE1);		
	}

	public boolean write(Object e1, TupleType typeE1, Object e2, TupleType typeE2) {
		return myClient.write(e1, typeE1, e2, typeE2);
	}

	public boolean write(Object e1, TupleType typeE1, Object e2, TupleType typeE2, Object e3, TupleType typeE3) {
		return myClient.write(e1, typeE1, e2, typeE2, e3, typeE3);		
	}

	public Tuple read(TupleType typeE1, TupleType typeE2, TupleType typeE3) {
		return myClient.read(typeE1, typeE2, typeE3);
	}

	public Tuple read(TupleType typeE1, TupleType typeE2, TupleType typeE3, String tuple1, String tuple2, String tuple3) {
		return myClient.read(typeE1, typeE2, typeE3, tuple1, tuple2, tuple3);
	}

	public Tuple take(TupleType typeE1, TupleType typeE2, TupleType typeE3) {
		return myClient.take(typeE1, typeE2, typeE3);
	}

	public Tuple take(TupleType typeE1, TupleType typeE2, TupleType typeE3, String tuple1, String tuple2, String tuple3) {
		return myClient.take(typeE1, typeE2, typeE3, tuple1, tuple2, tuple3);
	}

	public Tuple[] readAll() {
		return myClient.readAll();
	}

	public boolean ping() {
		return myClient.ping();
	}

	public TupleSpace getTupleSpace()
	{
		return myClient.getTupleSpace();
	}
}

